# -*- coding: utf-8 -*-
# @Time    : 2022/7/15 17:21
# @Author  : catherine
# @Email   : catherine_csq@163.com
# @File    : login_page.py
# @Software: PyCharm
from selenium import webdriver
from selenium.webdriver.common.by import By
from pages.base_page import BasePage
from tools.tools import chrome_driver

class LoginPage(BasePage):
    '''登录页面类'''
    url='http://192.168.189.1:8081/crm/index.php?m=user&a=login'
    #定位器
    username_locator=(By.NAME, 'name')
    password_locator = (By.NAME, 'password')
    login_btn_locator = (By.NAME, 'submit')


    def input_username(self,username):
        '''输入用户名'''
        # self.driver.find_element(*self.username_locator).send_keys(username)
        self.find_element(self.username_locator).send_keys(username)

    def input_password(self,password):
        '''输入密码'''
        # self.driver.find_element(*self.password_locator).send_keys(password)
        self.find_element(self.password_locator).send_keys(password)

    def click_login_btn(self):
        '''点击登录'''
        # self.driver.find_element(*self.login_btn_locator).click()
        self.find_element(self.login_btn_locator).click()


